/*
package com.yigerende.util;


import com.yigerende.pojo.Account;
import com.yigerende.pojo.TUser;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

*/
/*@Component*//*

@WebFilter(urlPatterns = {"/index.html","/account/index/sy","/order.html","/order/jr"},filterName = "userHandler")
public class UserHandler implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //把HttpServletRequest转换成HttpServletRequest
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        HttpServletResponse response = (HttpServletResponse) servletResponse;
        HttpSession session = request.getSession();
        Account user = (Account) session.getAttribute("user");
        if(user == null){
            request.getRequestDispatcher("/account/logout").forward(request, response);
        }else{
            //放行
            filterChain.doFilter(servletRequest,servletResponse);
        }
    }

    @Override
    public void destroy() {

    }
}
*/
